home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / perl5 / Net / DBus / Binding / Value.pm < prev    next >
Encoding:
Perl POD Document  |  2008-02-20  |  2.2 KB  |  116 lines

  1. # -*- perl -*-
  2. #
  3. # Copyright (C) 2004-2006 Daniel P. Berrange
  4. #
  5. # This program is free software; You can redistribute it and/or modify
  6. # it under the same terms as Perl itself. Either:
  7. #
  8. # a) the GNU General Public License as published by the Free
  9. #   Software Foundation; either version 2, or (at your option) any
  10. #   later version,
  11. #
  12. # or
  13. #
  14. # b) the "Artistic License"
  15. #
  16. # The file "COPYING" distributed along with this file provides full
  17. # details of the terms and conditions of the two licenses.
  18.  
  19. =pod
  20.  
  21. =head1 NAME
  22.  
  23. Net::DBus::Binding::Value - Strongly typed data value
  24.  
  25. =head1 SYNOPSIS
  26.  
  27.   # Import the convenience functions
  28.   use Net::DBus qw(:typing);
  29.  
  30.   # Call a method with passing an int32
  31.   $object->doit(dint32("3"));
  32.  
  33. =head1 DESCRIPTION
  34.  
  35. This module provides a simple wrapper around a raw Perl value,
  36. associating an explicit DBus type with the value. This is used
  37. in cases where a client is communicating with a server which does
  38. not provide introspection data, but for which the basic data types
  39. are not sufficient. This class should not be used directly, rather
  40. the convenience functions in L<Net::DBus> be called.
  41.  
  42. =head1 METHODS
  43.  
  44. =over 4
  45.  
  46. =cut
  47.  
  48. package Net::DBus::Binding::Value;
  49.  
  50. use strict;
  51. use warnings;
  52.  
  53. =item my $value = Net::DBus::Binding::Value->new($type, $value);
  54.  
  55. Creates a wrapper for the perl value C<$value> marking it as having
  56. the dbus data type C<$type>. It is not neccessary to call this method
  57. directly, instead the data typing methods in the L<Net::DBus> object
  58. should be used.
  59.  
  60. =cut
  61.  
  62. sub new {
  63.     my $class = shift;
  64.     my $self = [];
  65.     
  66.     $self->[0] = shift;
  67.     $self->[1] = shift;
  68.     
  69.     bless $self, $class;
  70.  
  71.     return $self;
  72. }
  73.  
  74. =item my $raw = $value->value
  75.  
  76. Returns the raw perl value wrapped by this object
  77.  
  78. =cut
  79.  
  80. sub value {
  81.     my $self = shift;
  82.     return $self->[1];
  83. }
  84.  
  85. =item my $type = $value->type
  86.  
  87. Returns the dbus data type this value is marked
  88. as having
  89.  
  90. =cut
  91.  
  92. sub type {
  93.     my $self = shift;
  94.     return $self->[0];
  95. }
  96.  
  97. 1;
  98.  
  99. =pod
  100.  
  101. =back
  102.  
  103. =head1 SEE ALSO
  104.  
  105. L<Net::DBus>, L<Net::DBus::Binding::Introspector>, L<Net::DBus::Binding::Iterator>
  106.  
  107. =head1 AUTHOR
  108.  
  109. Daniel Berrange E<lt>dan@berrange.comE<gt>
  110.  
  111. =head1 COPYRIGHT AND LICENSE
  112.  
  113. Copyright 2004-2005 by Daniel Berrange
  114.  
  115. =cut
  116.